package com.qiumo.gmtool.common;

import java.util.HashMap;

public class RetResult extends HashMap<String, Object> {

    public RetResult() {
    }

    public RetResult(int code, String msg) {
        super.put("code", code);
        super.put("msg", msg);
    }

    public RetResult(int code, String msg, Object data) {
        super.put("code", code);
        super.put("msg", msg);
        super.put("data", data);

    }

    public static RetResult succ(int code, String msg, Object data) {
        return new RetResult(code, msg, data);
    }

    public static RetResult succ(String msg, Object data) {
        return new RetResult(200, msg, data);
    }

    public static RetResult succMsg(String msg) {
        return new RetResult(200, msg, null);
    }

    public static RetResult succ(Object data) {
        return new RetResult(200, null, data);
    }

    public static RetResult err(int code, String msg, Object data) {
        return new RetResult(code, msg, data);
    }

    public static RetResult err(String msg, Object data) {
        return new RetResult(500, msg, data);
    }

    public static RetResult err(String msg) {
        return new RetResult(500, msg, null);
    }

    public static RetResult err(Object data) {
        return new RetResult(500, null, data);
    }
}
